/*
  Copyright 2005 - Daniel Lowd

  This file is part of the nbe code available at http://www.cs.washington.edu/ai/nbe/. There are some modifications to 
  integrate the original code of Daniel Lowd into the eapmlib library. The NBE method is explained in:

  Daniel Lowd and Pedro Domingos. 'Naive Bayes Models for Probability Estimation'. 
  Proceedings of the Twenty-Second International Conference on Machine Learning (ICML), 2005. 
  Bonn, Germany: ACM Press.
*/
/*!
\file Abstraction.h
\brief Abstraction declaration
\author Daniel Lowd

  The abstraction referes to each cluster in the probabilistic model.
*/
#ifndef ABSTRACTION_H
#define ABSTRACTION_H

#include "EvolutiveLib.h"
#include "VarSet.h"

namespace NBE {

class Abstraction : public VarSet
{
public:
    Abstraction() :VarSet(), data(NULL), weight(0) {}

    Abstraction(const NumSet<double>& v)
        :VarSet(v), data(NULL), weight(0) {}

    Abstraction(VarSchema s)
        :VarSet(s.getNumVars()), data(NULL), weight(0) {}


    double getWeight() const { return weight; }
    void   setWeight(double w) { weight = w; }

    void* getData() { return data; }
    void setData(void* p) { data = p; }

private:
    void* data;
    double weight;
};

// Read an Abstraction from a stream.
inline istream& operator>>(istream& in, Abstraction& abs)
{
    VarSet v;
    in >> v;

    abs = Abstraction(v);
	return in;
}

}
#endif
